package com.wzx.common.constants;

/**
 * @author wzx
 * @version 1.0
 * @date 2022/1/21 - 9:57
 * @description 标题
 */
public enum StatusCode {
    //区分与http状态码  你业务状态码 不要和http本身的状态码冲突 这样容易误会
    SUCCESS(0000, "操作成功"),
    PARAM_ERROR(9991, "参数异常"),
    NOT_FOUND(9992, "资源不存在"),
    FAILURE(9993, "系统异常"),
    CUSTOM_FAILURE(9994, "自定义异常错误"),
    NEED_CODE(9995, "登录次数过多"),
    OTHER_ERROR(9999, "其他错误"),
    ;
    private final Integer code;

    private final String message;

    StatusCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    //获取状态码
    public Integer code() {
        return code;
    }

    //获取信息
    public String message() {
        return message;
    }

    @Override
    public String toString() {
        return String.valueOf(this.code);
    }
}
